<me:UIAM06 x:Class="WPFExcelReport.TAMEZL"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
           xmlns:me="clr-namespace:WPFExcelReport" 
           xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
           xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
           xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
           xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
           xmlns:AM="clr-namespace:WPFExcelReport;assembly=TAMSTAMM" 
           xmlns:Localization="clr-namespace:Localization;assembly=Localization"
           x:Name="TV"
           Loaded="Window_Loaded">
    <me:UIAM06.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAM06.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"  >
            <WrapPanel Visibility="Collapsed">
                <Button Click="ResetSeq" Content="{Binding Source={Localization:Translate Word=重置序列号}}"
                    Visibility="{Binding IsITX,Converter={StaticResource bv}}"/>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  Visibility="Collapsed"
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                    <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印确认函}}" />
                </Grid>
            </WrapPanel>

            <WrapPanel   >
                <Button  Click="EditCommand" Width="24" Height="20" IsEnabled="{Binding IsCanChg,ElementName=TV}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                    </Button.Background>
                </Button>
                <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"  IsEnabled="{Binding IsCanDelete,ElementName=TV}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>

                <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24"  IsEnabled="{Binding IsEdit,ElementName=TV}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
                <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
                <Button Click="CopyMTPCommand" Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=复制到同类型}}"  /> 
                <Button Click="CopyMDCommand" Margin="10,0,0,0"  Content="{Binding Source={Localization:Translate Word=复制到所有模块}}" /> 
            </WrapPanel>
            <WrapPanel>
                <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                    </Button.Background>
                </Button>
                <WrapPanel IsEnabled="{Binding IsNew,ElementName=TV}">
                    <TextBlock Text="{Binding Source={Localization:Translate Word=参数个数:}}"/>
                    <ex:NumericBox Grid.Column="1" FontSize="16"  
                            Text="{Binding QTY,ElementName=TV}" Width="40" />
                    <TextBlock Text="{Binding Source={Localization:Translate Word=参数ID:}}"/>
                    <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="3"  
                          PRE="000"  CharacterCasing="Upper" Text="{Binding EINSTNR,ElementName=TV}" Width="40" />
                    <TextBlock Text="{Binding Source={Localization:Translate Word=BDE前缀:}}"/>
                    <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="4"  
                          PRE="0000"  CharacterCasing="Upper" Text="{Binding UPOS,ElementName=TV}" Width="60" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=方法}}"/>
                    <SD:K0706 
                            IsEdit="True"
                            KEY="{Binding MESCHL,ElementName=TV}"
                          />
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>

            </WrapPanel>
            <StackPanel>
                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=模块}}"/>
                    <TextBlock  Text="{Binding AMEMODNR}" Width="24" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=序号}}"/>
                    <TextBlock  Text="{Binding AMEEINSTNR}" Width="24" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=说明}}"/>
                    <ex:TXT72 MaxLength="40"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEBEZ,Converter={StaticResource gb2312}}" Width="120" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=简述}}"/>
                    <ex:TXT72 MaxLength="10"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEKBEZ,Converter={StaticResource gb2312}}" Width="120" />
                </WrapPanel>
                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=BDE}}"/>
                    <me:TSZL06 
                            IsEdit="{Binding IsEdit,ElementName=TV}" 
                            BDEKEN="{Binding BDEKEN,ElementName=TV}" 
                       />
                    <ex:TXT72 MaxLength="8"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEBDEKEN,Converter={StaticResource gb2312}}" Width="120" />
                </WrapPanel>

                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=方法}}"/>
                    <SD:K0706 
                    IsEdit="{Binding IsEdit,ElementName=TV}"
                    KEY="{Binding MESCHL,ElementName=TV}"/>
                    <ex:TXT72 MaxLength="2"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEMESCHL}" Width="80" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=起始位置}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTVON}" Width="80" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=个数}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTBIS}" Width="40" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=刷新频率(秒)}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEINTERVAL,Converter={StaticResource d1000}}" Width="40" />

                </WrapPanel>
                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=值1}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTEX1}" Width="120" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=值2}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTEX2}" Width="120" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=值3}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTEX3}" Width="120" />
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=值4}}"/>
                    <ex:TXT72 MaxLength="16"  
                      IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                      Text="{Binding AMEWERTEX4}" Width="120" />
                </WrapPanel> 
                <WrapPanel>
                    <SD:K8880  IsEdit="{Binding IsEdit,ElementName=TV}"
                       Visibility="Collapsed"
                       KEY="{Binding KEY,ElementName=TV}"
                       ORDERNUM="{Binding KEY,ElementName=TV}"
                />
                </WrapPanel>
            </StackPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding AMEMODNR}" Header="{Binding Source={Localization:Translate Word=模块}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEEINSTNR,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=项目}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEBEZ,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=说明}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEKBEZ,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=简述}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEBDEKEN}" Header="{Binding Source={Localization:Translate Word=BDE}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEMESCHL}" Header="{Binding Source={Localization:Translate Word=方法}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEWERTVON}" Header="{Binding Source={Localization:Translate Word=起始位置}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEINTERVAL,Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=刷新频率}}" Width="Auto"/>                
                <DataGridTextColumn  Binding="{Binding AMEWERTBIS}" Header="{Binding Source={Localization:Translate Word=个数}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEWERTEX1}" Header="{Binding Source={Localization:Translate Word=值1}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEWERTEX2}" Header="{Binding Source={Localization:Translate Word=值2}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEWERTEX3}" Header="{Binding Source={Localization:Translate Word=值3}}" Width="Auto"/>
                <DataGridTextColumn  Binding="{Binding AMEWERTEX4}" Header="{Binding Source={Localization:Translate Word=值4}}" Width="Auto"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</me:UIAM06>
